﻿using MvvmCross.Core.ViewModels;
using MvvmCross.Platform;
using MvvmCross.Wpf.Views;

namespace Sidvall.UI.Wpf.Presenters
{
    public class RegionPresenter : Sidvall.UI.Presenters.RegionPresenterBase, IMvxWpfViewPresenter
    {
        #region Public Members

        #region MainWindow

        public override object MainWindow
        {
            get
            {
                return Sidvall.UI.Wpf.SystemContext.Current.MainWindow;
            }
        }

        #endregion

        #region Close


        public void Close(IMvxViewModel toClose)
        {
        }

        #endregion
        #region CloseApplication

        public override void CloseApplication()
        {
            Sidvall.UI.Wpf.SystemContext.Current.MainWindow.Close();
        }

        #endregion
        #region CreateView

        public override object CreateView(MvxViewModelRequest request)
        {
            if (request == null)
                return null;
            var loader = Mvx.Resolve<IMvxSimpleWpfViewLoader>();
            return loader.CreateView(request);
        }

        #endregion

        #endregion
        #region Constructors

        public RegionPresenter()
        {
        }

        #endregion
    }
}
